cmake_minimum_required(VERSION 2.8)

PROJECT( VirtualSurgery )

FIND_PACKAGE( ITK)
IF( ITK_FOUND )
	INCLUDE( ${USE_ITK_FILE})
ENDIF( ITK_FOUND)

FIND_PACKAGE( VTK)
IF( VTK_FOUND)
	INCLUDE( ${USE_VTK_FILE})
ENDIF ( VTK_FOUND)



# use what QVTK built with
SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
SET(DESIRED_QT_VERSION ${VTK_DESIRED_QT_VERSION} CACHE FILEPATH "") 

FIND_PACKAGE(Qt4)
SET(QT_USE_QTTEST 1)
INCLUDE(${QT_USE_FILE})


INCLUDE_DIRECTORIES(
  ${QT_INCLUDE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)


SET(VISURSrcs 
  Main.cpp
  MainWindow.cpp 
  View.cpp 
  View2d.cpp 
  View3d.cpp 
  DisplayFramework.cpp 
  DisplayModel.cpp
  
  Source.cpp 
  SurfaceSource.cpp
  SourceIO.cpp
  PipelineModel.cpp
  PipelineTreeView.cpp
  VolumeSource.cpp
  
  VolumePanel.cpp
  
  ToolBar.cpp
  
  SourcePipelineDock.cpp
  ControlPanelDock.cpp
  ControlPanelBase.cpp
  ControlPanelHome.cpp
  HoverPoints.cpp
  VolumeRenderingWidget.cpp
  SegmentationPanels.cpp
  
  InteractorStyles.cpp
  JJConnectedComponent.cpp
  jjdistancemap.cpp
  JJSkeleton.cpp
  maskvolume.cpp
  CenterLinePanel.cpp
)
    
    
SET(VISURHeaders 
  MainWindow.h 
  Common.h

  View.h 
  View2d.h 
  View3d.h 
  DisplayFramework.h 
  DisplayModel.h

  Source.h 
  VolumeSource.h
  SurfaceSource.h
  ImageSource.h
  SourceIO.h
  PipelineModel.h
  
  SourcePipelineDock.h 
  PipelineTreeView.h
  
  LoadDataThreadBase.h
  LoadDicomSeriesThread.h
  FilteringThreadBase.h
  SmoothingThreads.h
  SegmentationThreads.h
  
  ControlPanelDock.h
  ControlPanelBase.h
  ControlPanelHome.h
  SmoothingPanel.h
  SegmentationPanels.h
  SurfacePanel.h
  VolumePanel.h
  
  ProgressBar.h
  ToolBar.h
  
  itkQtAdaptor.h
  itkQtLightIndicator.h
  HoverPoints.h
  VolumeRenderingWidget.h
  InteractorStyles.h
  ThresholdingPanel.h
  
  CenterLinePanel.h
  CenterLineThread.h

  JJConnectedComponent.h
  jjdistancemap.h
  JJSkeleton.h
  maskvolume.h
)
	
	
SET(UIS
  PipelineWidget.ui 
  SmoothingPanel.ui
  VesselProcessing.ui
  SegConfidenceConnected.ui
  SegThresholdLevelSet.ui
  ControlPanelHome.ui
  View2dToolbar.ui
  ProgressBar.ui
  SurfaceProperty.ui
  VolumeProperty.ui
  ThresholdingPanel.ui
  PixelGearPanel.ui
  CenterLinePanel.ui
)
	
	
SET(VISURRes Resources.qrc)


IF (WIN64)
ADD_DEFINITIONS (/D _CRT_SECURE_NO_WARNINGS)
ENDIF (WIN64)

	
QT4_WRAP_UI(UIHeaders ${UIS})
QT4_WRAP_CPP(MOCSrcs ${VISURHeaders})
QT4_ADD_RESOURCES(Resources ${VISURRes})
ADD_DEFINITIONS(-DQT_GUI_LIBS -DQT_QTEST_LIBS -DQT_CORE_LIBS -DQT3_SUPPORT -D_SCL_SECURE_NO_WARNINGS)
SET_SOURCE_FILES_PROPERTIES(${VISURSrcs} PROPERTIES
                            OBJECT_DEPENDS "${UIHeaders}")

# It's nice to have the ui in the windows project file...just double click on it
# and designer comes up on that ui file :)
IF (${CMAKE_BUILD_TOOL} MATCHES "msdev")
  SET (VISURSrcs ${VISURSrcs} ${UIS})
ENDIF (${CMAKE_BUILD_TOOL} MATCHES "msdev")
IF (${CMAKE_BUILD_TOOL} MATCHES "devenv")
  SET (VISURSrcs ${VISURSrcs} ${UIS})
ENDIF (${CMAKE_BUILD_TOOL} MATCHES "devenv")



ADD_EXECUTABLE( VirtualSurgery ${VISURSrcs} ${UISrcs} ${MOCSrcs} ${VISURHeaders} ${Resources})

TARGET_LINK_LIBRARIES( VirtualSurgery
  QVTK 
  ${QT_LIBRARIES}
  ITKCommon
  ITKBasicFilters
  ITKIO
  ITKAlgorithms
  vtkRendering 
  vtkGraphics 
  vtkHybrid
  vtkImaging 
  vtkIO 
  vtkFiltering 
  vtkCommon 
  vtkWidgets 
  vtkRendering 
  vtkVolumeRendering
)


#  ITKCommon
#  ITKIOBase
#  ITKIOGDCM
#  ITKIOBMP
#  ITKIOJPEG
#  ITKIOTIFF
#  ITKIONRRD
#  ITKIOPNG
#  ITKIOLSM
#ITKIOIPL
#ITKIOGIPL
#ITKIOStimulate
#ITKIOSiemens
#ITKIOXML
#ITKIOVTK
#ITKIOHDF5
#  ITKReview
